home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 April / Chip CMCD0400.iso / SOFTWARE / Shareware / UtilDiverse / TechSched / data1.cab / VB_Demo_1 / CALLER.FRM (.txt) next >
Encoding:
Visual Basic Form  |  2000-02-25  |  5.7 KB  |  155 lines

  1. VERSION 5.00
  2. Begin VB.Form frmMain 
  3.    Appearance      =   0  'Flat
  4.    BackColor       =   &H80000005&
  5.    Caption         =   "Call TechScheduler API DLL"
  6.    ClientHeight    =   2175
  7.    ClientLeft      =   6585
  8.    ClientTop       =   4365
  9.    ClientWidth     =   4905
  10.    BeginProperty Font 
  11.       Name            =   "MS Sans Serif"
  12.       Size            =   8.25
  13.       Charset         =   0
  14.       Weight          =   700
  15.       Underline       =   0   'False
  16.       Italic          =   0   'False
  17.       Strikethrough   =   0   'False
  18.    EndProperty
  19.    ForeColor       =   &H80000008&
  20.    LinkTopic       =   "Form1"
  21.    PaletteMode     =   1  'UseZOrder
  22.    ScaleHeight     =   2175
  23.    ScaleWidth      =   4905
  24.    Begin VB.CommandButton Command1 
  25.       Caption         =   "Run Job"
  26.       Height          =   375
  27.       Left            =   2400
  28.       TabIndex        =   6
  29.       Top             =   1080
  30.       Width           =   2175
  31.    End
  32.    Begin VB.TextBox Text1 
  33.       Appearance      =   0  'Flat
  34.       Height          =   288
  35.       Left            =   2280
  36.       TabIndex        =   4
  37.       Top             =   480
  38.       Width           =   2535
  39.    End
  40.    Begin VB.TextBox txtValue 
  41.       Appearance      =   0  'Flat
  42.       Height          =   288
  43.       Left            =   2280
  44.       TabIndex        =   2
  45.       Top             =   120
  46.       Width           =   2535
  47.    End
  48.    Begin VB.CommandButton btnTestFunc 
  49.       Appearance      =   0  'Flat
  50.       Caption         =   "Load TechScheduler"
  51.       Height          =   372
  52.       Left            =   120
  53.       TabIndex        =   1
  54.       Top             =   1080
  55.       Width           =   2175
  56.    End
  57.    Begin VB.CommandButton btnTestProc 
  58.       Appearance      =   0  'Flat
  59.       Caption         =   "Kill TechScheduler"
  60.       Height          =   372
  61.       Left            =   120
  62.       TabIndex        =   0
  63.       Top             =   1560
  64.       Width           =   2175
  65.    End
  66.    Begin VB.Label Label2 
  67.       Caption         =   "Job Name:"
  68.       Height          =   255
  69.       Left            =   240
  70.       TabIndex        =   5
  71.       Top             =   480
  72.       Width           =   1935
  73.    End
  74.    Begin VB.Label Label1 
  75.       Caption         =   "Techscheduler Path"
  76.       Height          =   255
  77.       Left            =   240
  78.       TabIndex        =   3
  79.       Top             =   120
  80.       Width           =   1935
  81.    End
  82. Attribute VB_Name = "frmMain"
  83. Attribute VB_GlobalNameSpace = False
  84. Attribute VB_Creatable = False
  85. Attribute VB_PredeclaredId = True
  86. Attribute VB_Exposed = False
  87. ' Visual Basic 6.0 Test program for the TechScheduler API.
  88. ' Requires TKSHDAPI.DLL to be in the Windows or same directory.
  89. ' This demo can be used without any restrictions and can be
  90. ' modified without prior permission. We request that updates
  91. ' and bugs be sent to Winutils@aol.com
  92. ' copyright 1998-99 Dean Software Design
  93. ' www.winutils.com
  94. Option Explicit
  95. ' Declare the API functions in the DLL
  96. Private Declare Function RunScheduler Lib "TKSHDAPI.DLL" (ByVal CallerHWND As Integer, ByVal Path As String) As Integer
  97. Private Declare Function PauseScheduler Lib "TKSHDAPI.DLL" () As Integer
  98. Private Declare Function StartScheduler Lib "TKSHDAPI.DLL" () As Integer
  99. Private Declare Function KillScheduler Lib "TKSHDAPI.DLL" () As Integer
  100. Private Declare Function RunJob Lib "TKSHDAPI.DLL" (ByVal Job As String) As Integer
  101. Private Declare Function PauseJob Lib "TKSHDAPI.DLL" (ByVal Job As String) As Integer
  102. Private Declare Function StartJob Lib "TKSHDAPI.DLL" (ByVal Job As String) As Integer
  103. Private Declare Function DeleteJob Lib "TKSHDAPI.DLL" (ByVal Job As String) As Integer
  104. Private Declare Function SetJobParameter Lib "TKSHDAPI.DLL" (ByVal Job As String, ByVal ParamId As String, _
  105.                          ByVal Strdata As String, ByVal Intdata As Integer, ByVal Booldata As Boolean) As Integer
  106. Private Declare Function GetLastAPIError Lib "TKSHDAPI.DLL" () As Integer
  107. Private Declare Function ReadJobFile Lib "TKSHDAPI.DLL" (ByVal Job As String) As Integer
  108. Private Declare Function SetConfigParameter Lib "TKSHDAPI.DLL" (ByVal ParamId As String, _
  109.                          ByVal Strdata As String, ByVal Intdata As Integer, ByVal Booldata As Boolean) As Integer
  110. ' Global variables
  111. Dim Myresult As Integer
  112. Dim Mystring As String
  113. Private Sub btnTestFunc_Click()
  114.     ' is there a path to pass?
  115.     If Len(txtValue.Text) > 0 Then
  116.        ' put the edit field value into our string variable
  117.        Mystring = txtValue.Text
  118.        ' run the function with the application handle
  119.        Myresult = RunScheduler(Me.hWnd, Mystring)
  120.        Select Case Myresult
  121.           Case 0
  122.               MsgBox "TechScheduler Started", vbOKOnly, "API Example"
  123.           ' you could put other return codes here too
  124.           Case Else
  125.               MsgBox "TechScheduler Start Failure", vbExclamation, "API Example"
  126.        End Select
  127.     Else
  128.        MsgBox "Enter TechScheduler Path", vbExclamation, "API Example"
  129.     End If
  130. End Sub
  131. Private Sub btnTestProc_Click()
  132.     Myresult = KillScheduler
  133.     Select Case Myresult
  134.        Case 0
  135.            MsgBox "TechScheduler Killed", vbOKOnly, "API Example"
  136.           
  137.        Case Else
  138.            MsgBox "TechScheduler Shutdown Failure", vbExclamation, "API Example"
  139.     End Select
  140. End Sub
  141. Private Sub Command1_Click()
  142.     If Len(Text1.Text) > 0 Then
  143.        Mystring = Text1.Text
  144.        Myresult = RunJob(Mystring)
  145.        Select Case Myresult
  146.           Case 0
  147.               MsgBox "Job Started", vbOKOnly, "API Example"
  148.           Case Else
  149.               MsgBox "Job Start Failure", vbExclamation, "API Example"
  150.        End Select
  151.     Else
  152.        MsgBox "No Job Entered", vbExclamation, "API Example"
  153.     End If
  154. End Sub
  155.